# User Var
N=2
E=ES
ONE_BUF=
PROG=test$(E)$(N)$(ONE_BUF)
PPROG=fp_$(E)$(N)
ARGS=10
# Global values
ERL = erl
EBIN = ebin
CFLAGS = -pa $(EBIN)
ECFLAGS = -noinput +B -eval 'case make:all() of up_to_date -> halt(0); error -> halt(1) end.'
CC = $(ERL) $(CFLAGS)
ETFLAGS = -noshell -s $(PROG) run -s init stop
EPFLAGS = -noshell -s $(PPROG) run -s init stop
EEDM_FIND_K_FLAGS = -noshell -s $(PROG) run_k $(ARGS) -s init stop

# Tasks
all: compile

compile: ebin
	@$(CC) $(ECFLAGS)

ebin:
	@mkdir $(EBIN)

test: compile
	cd $(EBIN)
	@$(CC) $(ETFLAGS)

fprof: compile
	cd $(EBIN)
	@$(CC) $(EPFLAGS)

edmk: compile
	cd $(EBIN)
	@$(CC) $(EEDM_FIND_K_FLAGS)
